how to write behavioural code for 3 bit counter